<?php
/**
 * Created by PhpStorm.
 * User: zhou
 * Date: 2019/3/14
 * Time: 上午12:12
 */

namespace App\Http\Controllers\Admin;


use App\Http\Controllers\ApiController;
use App\Http\Controllers\Controller;
use App\Models\Hotel;
use App\Models\Mac;
use App\Models\MachineModel;
use Illuminate\Http\Request;

class MachineController extends Controller
{
    public function index(Request $request,$hotel_id = '')
    {
        $hotel          = Hotel::list('');
        $unbind_mac = Mac::unbind_list();
        $machineList    = MachineModel::getMachineList();
        return view('admin.machine.index',['hotel'=>json_encode($hotel),'machineList'=>json_encode($machineList),'unbind_mac'=>json_encode($unbind_mac),'hotel_id'=> empty($hotel_id)?0:$hotel_id]);
    }

    public function getHotelList(Request $request)
    {
        $page = $request->input('page');
        $machineList    = MachineModel::getMachineList($page);
        return ApiController::response($machineList);
    }



}